From: Jan Beulich Date: Fri, 13 May 2016 17:14:58 +0000 (+0100) Subject: x86: use 32-bit loads for 32-bit PV guest state reload X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1120 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=25eb87cb3242474413de439321b9c92b747ce8ab;p=xen.git x86: use 32-bit loads for 32-bit PV guest state reload This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Release-acked-by: Wei Liu --- diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h index 963e6eae91..2bb8a6b0ff 100644 --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -313,6 +313,13 @@ static always_inline void stac(void) 987: .endm +#define LOAD_ONE_REG(reg, compat) \ +.if !(compat); \ + movq UREGS_r##reg(%rsp),%r##reg; \ +.else; \ + movl UREGS_r##reg(%rsp),%e##reg; \ +.endif + /* * Reload registers not preserved by C code from frame. * @@ -326,16 +333,14 @@ static always_inline void stac(void) movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 -.if \ax - movq UREGS_rax(%rsp),%rax .endif -.elseif \ax - movl UREGS_rax(%rsp),%eax +.if \ax + LOAD_ONE_REG(ax, \compat) .endif - movq UREGS_rcx(%rsp),%rcx - movq UREGS_rdx(%rsp),%rdx - movq UREGS_rsi(%rsp),%rsi - movq UREGS_rdi(%rsp),%rdi + LOAD_ONE_REG(cx, \compat) + LOAD_ONE_REG(dx, \compat) + LOAD_ONE_REG(si, \compat) + LOAD_ONE_REG(di, \compat) .endm /* @@ -372,8 +377,9 @@ static always_inline void stac(void) .subsection 0 #endif .endif -987: movq UREGS_rbp(%rsp),%rbp - movq UREGS_rbx(%rsp),%rbx +987: + LOAD_ONE_REG(bp, \compat) + LOAD_ONE_REG(bx, \compat) subq $-(UREGS_error_code-UREGS_r15+\adj), %rsp .endm